<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../vue.js"></script>
</head>

<body>
    <div id="app">
        <p>v-model:绑定表单元素,操作数据：获取数据、设置数据。双向绑定</p>
        <!-- v-model可以拆分成两个指令：@、： -->
        <input type="text" v-model="val1">
        <p>当前数据的值：{{val1}}</p>
        <label>sex:</label>
        <input type="radio" value="1" v-model="val2">男
        <input type="radio" value="2" v-model="val2">女
        <p>当前性别：{{val2}}</p>
        <label>hoby:</label>
        <input v-for="(hobby,key,index) in hobbyList"
            :key="index"
            type="checkbox"
            :value="hobby"
            v-model="val3">
        <p>你的爱好：{{val3}}</p>
        <label>就业地</label>
        <select v-model="val4">
            <option value="1">上海</option>
            <option value="2">杭州</option>
            <option value="3">苏州</option>
            <option value="4">深圳</option>
        </select>
        <p>{{val4}}</p>
    </div>
    <script>
        let vm = new Vue({
            el: '#app',
            data: {
                val1: '',
                val2: 2,
                val3: [],
                val4: '3',
                hobbyList: [
                    {name: '唱', val: 'sing'},
                    {name: '跳', val: 'dance'},
                    {name: 'rap', val: 'rap'},
                    {name: '打篮球', val: 'basketball'},
                ]
            }
        })
    </script>
</body>

</html>